package com.zhengshang.api.service.impl;

import com.zhengshang.api.domain.AppGoodsChannel;
import com.zhengshang.api.mapper.AppGoodsChannelMapper;
import com.zhengshang.api.service.IAppGoodsChannelService;
import com.zhengshang.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 电商频道Service业务层处理
 *
 * @author zhengshang
 * @date 2022-04-16
 */
@Service
public class AppGoodsChannelServiceImpl implements IAppGoodsChannelService {
    @Autowired
    private AppGoodsChannelMapper appGoodsChannelMapper;

    /**
     * 查询电商频道
     *
     * @param goodsChannelId 电商频道ID
     * @return 电商频道
     */
    @Override
    public AppGoodsChannel selectAppGoodsChannelById(Long goodsChannelId) {
        return appGoodsChannelMapper.selectAppGoodsChannelById(goodsChannelId);
    }

    /**
     * 查询电商频道列表
     *
     * @param appGoodsChannel 电商频道
     * @return 电商频道
     */
    @Override
    public List<AppGoodsChannel> selectAppGoodsChannelList(AppGoodsChannel appGoodsChannel) {
        return appGoodsChannelMapper.selectAppGoodsChannelList(appGoodsChannel);
    }

    @Override
    public List<Map> selectAppGoodsChannelList1(Map params) {
        return appGoodsChannelMapper.selectAppGoodsChannelList1(params);
    }

    /**
     * 新增电商频道
     *
     * @param appGoodsChannel 电商频道
     * @return 结果
     */
    @Override
    public int insertAppGoodsChannel(AppGoodsChannel appGoodsChannel) {
        appGoodsChannel.setCreateTime(DateUtils.getNowDate());
        return appGoodsChannelMapper.insertAppGoodsChannel(appGoodsChannel);
    }

    /**
     * 修改电商频道
     *
     * @param appGoodsChannel 电商频道
     * @return 结果
     */
    @Override
    public int updateAppGoodsChannel(AppGoodsChannel appGoodsChannel) {
        appGoodsChannel.setUpdateTime(DateUtils.getNowDate());
        return appGoodsChannelMapper.updateAppGoodsChannel(appGoodsChannel);
    }

    /**
     * 批量删除电商频道
     *
     * @param goodsChannelIds 需要删除的电商频道ID
     * @return 结果
     */
    @Override
    public int deleteAppGoodsChannelByIds(Long[] goodsChannelIds) {
        return appGoodsChannelMapper.deleteAppGoodsChannelByIds(goodsChannelIds);
    }

    /**
     * 删除电商频道信息
     *
     * @param goodsChannelId 电商频道ID
     * @return 结果
     */
    @Override
    public int deleteAppGoodsChannelById(Long goodsChannelId) {
        return appGoodsChannelMapper.deleteAppGoodsChannelById(goodsChannelId);
    }

    @Override
    public List<AppGoodsChannel> queryAppGoodsChannelList(Long navigateId, Integer channelType) {
        return appGoodsChannelMapper.queryAppGoodsChannelList(navigateId, channelType);
    }
}
